package rsj.sql.user;

import com.rlyy.aibase.utils.base.MapNode;
import rsj.annotation.Param;
import rsj.annotation.Select;
import rsj.annotation.Update;
import rsj.api.user.entity.UserAccount;

/**
 * 用户
 *
 * @author yuanqinglong
 * @since 2021/7/16 16:01
 */
public interface UserAccountDao {


    /**
     * 添加用户
     *
     * @param createUser 创建用户
     */
    @Update(value = "INSERT INTO sys.sys_user (user_id,user_uname,user_password,user_org_id) VALUES (#{userId},#{userUname},#{userPassword},#{userOrgId})")
    void addUser(UserAccount createUser);


    /**
     * 获取用户
     *
     * @param orgId org id
     * @return {@link MapNode}
     */
    @Select(value = "SELECT user_uname,user_password FROM sys.sys_user WHERE org_id = #{orgId}")
    MapNode getUser(@Param(value = "orgId") String orgId);


    /**
     * 更新用户密码
     *
     * @param userAccount 用户帐户
     */
    @Update(value = "UPDATE sys.sys_user SET user_password = #{userPassword} WHERE user_uname = #{userUname}")
    void updateUserPassword(UserAccount userAccount);
}
